package com.caojing.haolemai.ui.home;

import com.caojing.haolemai.bean.HomeLvBean;
import com.caojing.haolemai.bean.HomeVpBean;
import com.caojing.haolemai.httputils.HttpUtils;

/**
 * Created by CaoJing on 2016/10/3.
 */
public class HomePresenter implements HomeContract.Presenter {

    private HomeContract.View view;
    private HomeContract.Model model;

    public HomePresenter(HomeContract.View view){
        this.view = view;
        this.model = new HomeModel();
    }

    @Override
    public void initData() {

        model.getHomeVpBean(new HttpUtils.HttpCallBack<HomeVpBean>() {
            @Override
            public void onSucess(HomeVpBean homeVpBean) {
                view.onSuccessGetHomeVpBean(homeVpBean);
            }

            @Override
            public void onFail() {
                view.onFailGetHomeVpBean("网络连接错误");
            }
        });
        model.getHomeLvBean(new HttpUtils.HttpCallBack<HomeLvBean>() {
            @Override
            public void onSucess(HomeLvBean homeLvBean) {
                view.onSuccessGetHomeLvBean(homeLvBean);
            }

            @Override
            public void onFail() {
                view.onFailGetHomeLvBean("网络连接错误");
            }
        });
    }
}
